


.global msum
.global msve
.global mreturn
.global sve_reg

/*
 * 1-4 paramter map to x0-x3
 * return val map x0
*/

msum:
	add x5, x0, x1
	mov x0, x5
	ret



msve:
	add x5, x0, x1
	// addpl x5, x0, 3 /*can not exec*/
	# ADD <Zdn>.<T>, <Zdn>.<T>, #<imm>{, <shift>}
	add z0.s, z0.s, #1
	fcpy    z0.s, p0/m, #5.00000000
	mov x0, x5
	ret

/*
	x0 return mem addr
	x1-x3 1...3
*/ 


mreturn:
	add x5, x1, x2
	str x5, [x0]	// long
	mov x1, 3
	str x5, [x0, #8]
	ret


sve_reg:
	mrs x0, ZIDR_EL1
	mrs x0, ID_AA64PFR0_EL1
	mrs x0, ID_AA64ZFR0_EL1
	mrs x0, CPACR_EL1
	mrs x0, HCR_EL2
	mrs x0, CPTR_EL2
	mrs x0, CPTR_EL3
	mrs x0, ZCR_EL1
	mrs x0, ZCR_EL2
	mrs x0, ZCR_EL3
	mrs x0, TCR_EL1
	mrs x0, ESR_EL1
	mrs x0, ESR_EL2
	mrs x0, ESR_EL3
	ret